package com.meichis.mcsappframework.adapter.pagertabstrip;

import android.widget.ImageView;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentPagerAdapter;

import com.nostra13.universalimageloader.core.DisplayImageOptions;

public class PagerBottomAdapter extends FragmentPagerAdapter {

    private int[] resIds, selresIds;
    private Fragment[] fragmentContainter;
    private String[] resUrls, selresUrls, description;
    private ImageView.ScaleType scaleType;
    private DisplayImageOptions options;

    public PagerBottomAdapter(Fragment[] fragmentContainter, FragmentActivity activity) {
        super(activity.getSupportFragmentManager());
        this.fragmentContainter = fragmentContainter;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentContainter[position];
    }

    public void setImage(int[] resIds, int[] selresIds, ImageView.ScaleType scaleType) {
        this.resIds = resIds;
        this.selresIds = selresIds;
        this.scaleType = scaleType;
        //只能设置一种Image
        resUrls = null;
        selresUrls = null;
    }

    public void setImageUrl(String[] resUrls, String[] selresUrls, DisplayImageOptions options) {
        this.resUrls = resUrls;
        this.selresUrls = selresUrls;
        this.options = options;
    }

    public void setText(String[] description) {
        this.description = description;
    }

    @Override
    public int getCount() {
        return fragmentContainter != null ? fragmentContainter.length : 0;
    }

    public int[] getResIds() {
        return resIds;
    }

    public int[] getSelresIds() {
        return selresIds;
    }

    public String[] getResUrls() {
        return resUrls;
    }

    public String[] getSelresUrls() {
        return selresUrls;
    }

    public ImageView.ScaleType getScaleType() {
        return scaleType;
    }

    public DisplayImageOptions getOptions() {
        return options;
    }

    public String[] getDescription() {
        return description;
    }
}
